package top.ed333.mcplugins.configurableevents.requirement;

import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerEvent;
import org.jetbrains.annotations.NotNull;
import top.ed333.mcplugins.configurableevents.DependenciesResolver;
import top.ed333.mcplugins.configurableevents.VaultHelper;

public class PlayerInGroupReqGroup extends TargetedByPlayerEventReqGroup{
    public PlayerInGroupReqGroup(String groupName, @NotNull String ext) {
        super(groupName, ext);
    }

    @Override
    public String name() {
        return "PlayerInGroup";
    }

    @Override
    public boolean checkReq(@NotNull PlayerEvent event) {
        Player player = event.getPlayer();
        if (!DependenciesResolver.isVaultInstalled()) return false;
        return VaultHelper.getPlayerGroup(player).equals(getExt().toString());
    }
}
